export const regs = {
  Normal: {
    pattern: /^[\u4E00-\u9FA5A-Za-z0-9]+$/,
    // pattern: /^[\u4E00-\u9FA5A-Za-z0-9\.\，\。\,]+$/,
    message: "只能输入中文、英文、数字",
    trigger: "blur"
  },
  Alphabets: {
    pattern: /^[A-Za-z]+$/,
    message: "只能输入字母",
    trigger: "blur"
  },
  CNandEN: {
    pattern: /^[a-zA-Z\u4e00-\u9fa5]+$/,
    message: "只能使用中文、英文",
    trigger: "blur"
  },
  IP: {
    pattern: /^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$/,
    message: "请输入正确的IP",
    trigger: "blur"
  },
  Phone: {
    pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
    message: "手机号格式错误",
    trigger: "blur"
  },
  Number: {
    pattern: /^[0-9]*$/,
    message: "只能输入纯数字",
    trigger: "blur"
  },
  Number1: {
    pattern: /^[1-9]*$/,
    message: "只能输入大于1的纯数字",
    trigger: "blur"
  },
  Float(num) {
    let regstr = "^-?\\d+(\\.\\d{1," + num + "})?$";
    //const regex = /^-?\d+(\.\d{1,2})?$/;
    const message = "只能输入数字" + (num ? ",最多" + num + "位小数" : "");
    let pattern = num ? new RegExp(regstr) : /^[0-9]*$/;
    return {
      //pattern: regex,
      pattern: pattern,
      message: message,
      trigger: "blur"
    };
  },
  IdCard: {
    pattern: /^[1-9]\d{5}(18|19|20|(3\d))\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/,
    message: "请输入正确的身份证号码",
    trigger: "blur"
  }
};
